package com.daigoudao.web.model;

import java.math.BigDecimal;
import java.util.Date;

import com.daigoudao.util.StringUtils;

/**
 * 代购记录
 * 
 * @author zheng
 * 
 */
@SuppressWarnings("serial")
public class PurchaseRecord extends BasePageModel {

	private int orderId;

	/**
	 * 商品ID
	 */
	private int productId;

	/**
	 * 商品名称
	 */
	private String goodsName;

	private double price;

	private double serviceFee;

	/**
	 * 商品数量
	 */
	private int number;

	/**
	 * 交易状态
	 */
	private int state = -1;

	/**
	 * 交易开始时间
	 */
	private Date startTime;

	/**
	 * 购买人
	 */
	private UserModel buyer = new UserModel();

	/**
	 * 经纪人
	 */
	private UserModel broker = new UserModel();

	public String getGoodsName() {
		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public Date getStartTime() {
		return startTime;
	}

	public String getStartTimeStr() {
		return StringUtils.formatDate(startTime, "yyyy-MM-dd HH:mm:ss");
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public UserModel getBuyer() {
		return buyer;
	}

	public void setBuyer(UserModel buyer) {
		this.buyer = buyer;
	}

	public int getProductId() {
		return productId;
	}

	public void setProductId(int productId) {
		this.productId = productId;
	}

	public UserModel getBroker() {
		return broker;
	}

	public void setBroker(UserModel broker) {
		this.broker = broker;
	}

	public int getOrderId() {
		return orderId;
	}

	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}

	public double getPrice() {
		return BigDecimal.valueOf(price).setScale(2, BigDecimal.ROUND_HALF_UP)
				.doubleValue();
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public double getServiceFee() {
		return BigDecimal.valueOf(serviceFee)
				.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
	}

	public void setServiceFee(double serviceFee) {
		this.serviceFee = serviceFee;
	}

}
